<div class="popup_body">
    <div class="ui_table">
        <form method="post">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td width="100" align="right">机构类型：</td>
                    <td>
                        <select id="org_type" editable="false" style="width: 182px; height: 30px;"
                                class="easyui-combobox" name="orgType" required
                                data-options="
                                valueField: 'id',
                                textField: 'text',
                                onSelect: function(rec){
                                var url = '${contextPath}/security/hdw/exchange_amount_money_divide_detail/add_orgId.htm?typeId='+rec.id;
                                $('#org_id').combobox('reload', url);}">
                        <#list orgTypeList as e>
                            <option value="${e.getValue()}">${(e.getName())!''}</option>
                        </#list>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="80" align="right">机构：</td>
                    <td>
                        <input id="org_id" editable="false" style="width: 182px; height: 30px;" name="orgId"
                               class="easyui-combobox" required
                               data-options="valueField:'id',textField:'text'">
                    </td>
                </tr>
                <tr>
                    <td width="70" align="right">金额：</td>
                    <td><input type="number" min="0" name="money" id="money_id" class="text easyui-validatebox"
                               required="true"/></td>
                </tr>
                <tr>
                    <input type="hidden" name="snapshotPath" id="snapshot_path_${pid}">
                    <td align="right">支付截图：</td>
                    <td colspan="3 ">
                        <div class="portrait">
                            <a href="javascript:void(0)"><img id="image_${pid}"
                                                              src="${app.imagePath}/default_item.png"/><span>上传截图</span></a>
                        </div>
                    </td>
                </tr>

            </table>
        </form>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red ok">确定</button>
    <button class="btn btn_border close">关闭</button>
</div>
<script>

    function set_image(param) {
        $('#image_${pid}').attr('src', '${(controller.appConfig.staticUrl)!''}' + param.filePath);
        $('#snapshot_path_${pid}').val(param.filePath);
        $('#' + param.pid).window('close');
    }
    (function () {
        var pid = '${pid}',
                win = $('#' + pid),
                form = win.find('form');

        win.find('button.ok').click(function () {
            if ($("#image_${pid}").attr("src") == "${app.imagePath}/default_item.png") {
                alert("请上传交易截图");
                return false;
            }
            form.form('submit', {
                url: '${contextPath}/security/hdw/withdraw_cash/create.htm',
                onSubmit: function () {
                    if (!form.form('validate')) {
                        return false;
                    }

                    return true;
                },
                success: function (text) {
                    var json = $.evalJSON(text);
                <@app.json_jump/>
                    if (json.success) {
                        $.messager.alert('提示信息', '操作成功', 'info');
                        win.window('close');
                    } else {
                        $.messager.alert('提示信息', json.message, 'info');
                    }
                }
            });
        });
        win.find('button.close').click(function () {
            win.window('close');
        });
        win.find('.portrait').click(function () {
            App.dialog.show({
                css: 'width:558px;height:150px;overflow:visible;',
                title: '上传图片',
                href: "${contextPath}/security/hdw/withdraw_cash/image.htm",
                event: {
                    onClose: function () {
                    }
                }
            });
        });
        $('#org_type').combobox({
            onLoadSuccess: function () {
                var id = $("input[name='orgType']").val();
                if (id != "") {
                    $('#org_id').combobox({
                        valueField: 'id',
                        textField: 'text',
                        url: '${contextPath}/security/hdw/exchange_amount_money_divide_detail/add_orgId.htm?typeId=' + id
                    });
                }
            }
        });
    })()
</script>